import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'search_logic.dart';

class SearchPage extends StatelessWidget {
  SearchPage({Key? key}) : super(key: key);

  final logic = Get.put(SearchLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title:
              const Image(image: AssetImage("images/logo.png"), width: 100.0),
          actions: [
            IconButton(
              icon: const Icon(
                Icons.person,
                size: 36,
              ),

              /// icon:ImageIcon(AssetImage("images/person.png")),
              onPressed: () {},
            ),
          ],
        ),
        body: Container(
          child: Stack(children: [
            Container(
              decoration: const BoxDecoration(
                image: DecorationImage(
                  image: AssetImage('images/app_bg.png'),
                  fit: BoxFit.cover,
                ),
              ),
            ),
            Container(
                padding: EdgeInsets.all(16),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(
                      children: [
                        ElevatedButton(
                            onPressed: () =>
                                logic.showFirstDatePicker(context, true),
                            child: Text(
                              '开始时间:',
                              style: const TextStyle(
                                  color: Colors.black, fontSize: 20),
                            )),
                        Obx(() {
                          return Padding(
                            padding: EdgeInsets.only(left: 20),
                            child: Text(
                              ' ${logic.firstTime}',
                              style: const TextStyle(
                                  color: Colors.white, fontSize: 20),
                            ),
                          );
                        })
                      ],
                    ),
                    const SizedBox(height: 20),
                    Row(
                      children: [
                        ElevatedButton(
                            onPressed: () =>
                                logic.showFirstDatePicker(context, false),
                            child: Text(
                              '结束时间:',
                              style: const TextStyle(
                                  color: Colors.black, fontSize: 20),
                            )),
                        Obx(() {
                          return Padding(
                              padding: EdgeInsets.only(left: 20),
                              child: Text(' ${logic.secondTime}',  style: const TextStyle(
                                  color: Colors.white, fontSize: 20),));
                        })
                      ],
                    ),
                    const SizedBox(height: 40),
                    Center(
                        child: ElevatedButton(
                            onPressed: () {}, child: Text('确       定')))
                  ],
                ))
          ]),
        ));
  }
}
